import { getCode } from "@/utils/dicts";
// 定检预警详情
export const toolInspectStatVoList = {
  columns: [
    { label: "工具名", prop: "toolName" },
    {
      label: "定检状态",
      prop: "inspectState",
      formatter: row => {
        const result = getCode("inspectState", row.inspectState);
        if (row.remainingDays < 0 && result.value == 1) {
          return "超期待检查";
        }
        return result.label;
      }
    },
    { label: "定检时间", prop: "inspectTime" },
    { label: "剩余时间/天", prop: "remainingDays" }
  ]
};

// 门禁报警详情
export const warnRecordStatVoList = {
  columns: [
    { label: "工具名", prop: "toolName" },
    { label: "报警时间", prop: "warnTime" },
    { label: "存放位置", prop: "storageLocation" }
  ]
};

// 工具报修详情
export const toolReportFixStatVoList = {
  columns: [
    { label: "工具名", prop: "toolName" },
    { label: "工具编号", prop: "toolCode" },
    { label: "报修用户", prop: "reportFixUserNickName" },
    { label: "报修时间", prop: "reportFixTime" }
  ]
};

// 紧缺工具在位情况
export const toolScarceStatVoList = {
  columns: [
    { label: "工具名", prop: "toolName" },
    {
      label: "在位情况",
      prop: "toolState",
      formatter: row => {
        return row.toolState == 1 ? "未借" : "已借出";
      }
    },
    {
      label: "借用人",
      prop: "lendUserNickName",
      formatter: row => {
        if (row.toolState == 1) {
          return "";
        }
        return row.lendUserNickName;
      }
    },
    {
      label: "借用时长",
      prop: "lendTotalTime",
      formatter: row => {
        if (row.toolState == 1) {
          return "";
        }
        const mm = row.lendTotalTime;
        const h = Math.floor(mm / 60);
        const m = mm % 60;
        return `${h ? h + "时" : ""}${m}分`;
      }
    }
  ]
};
